package com.sweetguy.dto;

import cn.hutool.core.date.DateTime;
import com.sweetguy.constant.RE;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Future;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;

import static com.alibaba.nacos.api.naming.CommonParams.CODE;

@Schema(name = "优惠券添加DTO")
@Data
public class CouponsInsertDTO implements Serializable, RE {

    @NotEmpty(message = "标题不能为空")
    @Schema(description = "标题")
    @Pattern(regexp = TITLE_RE, message = TITLE_RE_MSG)
    private String title;

    @NotEmpty(message = "描述不能为空")
    @Schema(description = "描述")
    @Pattern(regexp = INFO_RE, message = INFO_RE_MSG)
    private String info;

    @NotEmpty(message = "兑换口令不能为空")
    @Schema(description = "兑换口令")
    private String code;

    @NotNull(message = "优惠金额不能为空")
    @Schema(description = "优惠金额")
    private Double cpPrice;

    @Future(message = "生效时间必须是一个未来的时间")
    @NotNull(message = "生效时间不能为空")
    @Schema(description = "优惠券生效时间")
    private LocalDateTime startTime;

    @Future(message = "失效时间必须是一个未来的时间")
    @NotNull(message = "失效时间不能为空")
    @Schema(description = "优惠券失效时间")
    private LocalDateTime endTime;
}
